#include "../include/client.h"

int clientRm(int sockFd, char *ss)
{
    char flag;
    char fileName[20] = {0};
    int res = 0;
    sscanf(ss, "%*s %s", fileName);

    send(sockFd, ss, 128, 0);

    recv(sockFd, &flag, 1, 0);

    if(flag == 'a'){
        printf("rm %s successful!\n", fileName);
        res = 1;
    }
    else if(flag == 'u'){
        //非法路径
        printf("illegal path!\n");
        res = -1;
    }
    else if(flag == 'e'){
        //试图删除非空目录
        printf("dir %s is not empty!\n", fileName);
        res = -1;
    }
    return res;
}

